﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;

namespace Infrastructure.Pub
{
    public class PubMethod
    {
        /// <summary>
        /// 写入日志文件
        /// </summary>
        /// <param name="ex"></param>
        public static void WirteExp(Exception ex)
        {
            try
            {
                var logPath = FileSugar.GetMapPath("~/") + "/log/log" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
                if (!FileSugar.IsExistFile(logPath))
                {
                    FileSugar.CreateFile(logPath);
                }
                FileSugar.AppendText(logPath, "***********开始:" + DateTime.Now + "***********");
                FileSugar.AppendText(logPath, ex.Message);
                FileSugar.AppendText(logPath, "***********结束***********\r\n");
            }
            catch
            {

            }
        }
    }
}
